home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun 1986 May & June
/
rerun-1986-05-06.d64
/
disk reader
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
7KB
|
261 lines
100 rem disk reader
180 close4:close1:close15:ok=0:clr
190 printchr$(147):fori=1to10:printchr$(17);chr$(32);:next
200 print"just a moment please":gosub2490:t$=chr$(147)+chr$(13)+chr$(13)
210 fori=1to13:t$=t$+chr$(32):next:fori=1to14:t$=t$+chr$(45):next
220 fori=1to12:t$=t$+chr$(157):next:t$=t$+"diskreader":fori=1to12
230 t$=t$+chr$(157):next:fori=1to14:t$=t$+chr$(45):next:t$=t$+chr$(13)
240 gosub1760:ifde<>5thengosub1220
250 ondegoto1920,1300,310,1570,2430
270 get#1,a$:l=l+1:ifl=65535thenl=0
280 ifst<>0then2280
290 d=asc(a$+chr$(0)):return
310 gosub2340:printt$:print:print
320 ifokthenprint#4,nf$:print#4:print#4
330 print" start address: $";
340 ifokthenprint#4,"start address: $";
350 gosub270:l1=d:gosub270:l2=d
360 l=l1+l2*256:d=l:gosub440:printh$:print:print
370 ifokthenprint#4,h$:print#4:print#4
380 gosub270:op=d
390 gosub440:a$=h$:gosub560
400 ifpeek(653)then400
410 ifpeek(197)=13then2280
420 goto380
440 h$=""
450 ifdthena=int(d/16)
460 h$=mid$("0123456789abcdef",1+d-a*16,1)+h$
470 d=a:ifdgoto450
480 iflen(h$)<2thenh$=right$("00"+h$,2)
490 iflen(h$)=3thenh$=right$("0000"+h$,4)
500 return
520 d=0:ifh$>""thenforh=1tolen(h$)
530 a=asc(mid$(h$,h,1))-48
540 d=d*16+a+(a>9)*7:next:return
560 gosub640
570 printxx$:ifokthenprint#4,xx$
580 ifot$="brk"orot$="rts"then610
590 ifleft$(ot$,3)="jmp"then610
600 return
610 printdi$:ifokthenprint#4,di$
620 return
640 d=l-1:gosub440:ox$=h$
650 iflen(ox$)<4thenox$=right$("0000"+ox$,4)
660 ox$="."+ox$:xx$=ox$+chr$(32)+a$+chr$(32)
670 ot$=left$(r$(op),3)
680 u$=right$(r$(op),1)
690 ifu$="*"thengosub760:return
700 ifu$="?"thengosub760:goto730
710 onasc(u$)-64gosub780,840,890,910,940,970,1020,1070,1100,1130,1190
720 h1$="":h2$="":return
730 if(op<32)or(op>127andop<160)or(op=34)thenreturn
740 xx$=xx$+chr$(32)+chr$(39)+chr$(18)+chr$(op)+chr$(146):return
760 xx$=xx$+left$(sp$,15)+ot$:return
780 ot$=ot$+chr$(32)+chr$(36)
790 gosub270:gosub440:h1$=h$
800 gosub270:gosub440:h2$=h$
810 xx$=xx$+h1$+chr$(32)+h2$+left$(sp$,10)+ot$+h2$+h1$
820 return
840 ot$=ot$+chr$(32)+chr$(35)+chr$(36)
850 gosub270:gosub440:h1$=h$
860 xx$=xx$+h1$+left$(sp$,13)+ot$+h1$
870 return
890 ot$=ot$+chr$(32)+chr$(36):goto850
910 ot$=ot$+chr$(32)+chr$(36):gosub790
920 xx$=xx$+chr$(44)+chr$(88):return
940 ot$=ot$+chr$(32)+chr$(36):gosub790
950 xx$=xx$+chr$(44)+chr$(89):return
970 ot$=ot$+chr$(32)+chr$(40)+chr$(36)
980 gosub850
990 xx$=xx$+chr$(44)+chr$(88)+chr$(41)
1000 return
1020 ot$=ot$+chr$(32)+chr$(40)+chr$(36)
1030 gosub850
1040 xx$=xx$+chr$(41)+chr$(44)+chr$(89)
1050 return
1070 ot$=ot$+chr$(32)+chr$(36):gosub850
1080 xx$=xx$+chr$(44)+chr$(88):return
1100 ot$=ot$+chr$(32)+chr$(36):gosub850
1110 xx$=xx$+chr$(44)+chr$(89):return
1130 ot$=ot$+chr$(32)+chr$(36)
1140 gosub270:ox=d:gosub440:h1$=h$
1150 ox=ox+(ox>127)*256:d=ox+l:gosub440:ox$=h$
1160 xx$=xx$+h1$+left$(sp$,13)+ot$+ox$
1170 return
1190 ot$=ot$+chr$(32)+chr$(40)+chr$(36)
1200 gosub790:xx$=xx$+chr$(41):return
1220 printt$:print:print
1230 print" output to screen ";
1240 print"or to printer (s/p)?":print
1250 geta$:ifa$<>"s"anda$<>"p"then1250
1260 ok=0:ifa$="p"thenok=1
1270 ifa$="p"thenopen4,4:print#4
1280 return
1300 gosub2340:printt$:print:print
1310 ifokthenprint#4,chr$(14);nf$:print#4:print#4,chr$(15)
1320 print" start address: $";
1330 gosub270:l1=d:gosub270:l2=d
1340 l=l1+l2*256:d=l:gosub440:printh$:print:print
1350 gosub270:gosub270
1360 ifd=0thenprint:print"e.o.f.":goto2280
1370 gosub270:n1=d:gosub270:n2=d
1380 n=n1+n2*256:printn;:ifokthenprint#4,n;
1390 gosub270
1400 ifpeek(653)then1400
1410 ifpeek(197)=13then2280
1420 ifd=0andokthenprint#4
1430 ifd=0thenprint:goto1350
1440 if(peek(212)<>0ord<128)andokthenprint#4,chr$(d);
1450 if(peek(212)<>0ord<128)thenprintchr$(d);:goto1470
1460 printba$(d-128);:ifokthenprint#4,ba$(d-128);
1470 ifokand(d=58ord=44)andpeek(211)>65then1520
1480 ifok=0and(d=58ord=44)andpeek(211)>36then1520
1490 ifokandpeek(211)>75then1520
1500 ifok=0andpeek(211)>38then1520
1510 goto1390
1520 z%=peek(212):print:ifokthenprint#4
1530 tp$=left$(sp$,len(str$(n))+1):poke212,z%
1540 printtp$;:ifokthenprint#4,tp$;
1550 goto1390
1570 gosub2340:printt$:print:print
1580 ifokthenprint#4,chr$(14);nf$
1590 ifokthenprint#4,chr$(15):print#4
1600 ifokthenprint#4:close4:ok=0
1610 ifokthenopen4,4,7
1620 nc%=0
1630 gosub270:ifokthennc%=nc%+1
1640 ifokandnc%>65thennc%=0:print#4
1650 ifpeek(653)then1650
1660 ifpeek(197)=13then2280
1670 ifokandd=34thenprint#4,chr$(39);
1680 ifd=34thenprintchr$(39);:goto1630
1690 ifokandd=13thenprint#4
1700 ifd=13thenprint:goto1630
1710 ifokand((d>31andd<128)ord>159)thenprint#4,chr$(d);
1720 if((d>31andd<128)ord>159)thenprintchr$(d);:goto1630
1730 printchr$(32);:ifokthenprint#4,chr$(32);
1740 goto1630
1760 printt$:print:print
1770 printtab(3);"(1) read directory":print
1780 printtab(3);"(2) read basic program":print
1790 printtab(3);"(3) read & disassemble machine code":print
1800 printtab(3);"(4) read & display file":print
1810 printtab(3);"(5) end "
1820 print:print:printtab(13)"select 1-5 ";
1830 fori=1to15:geta$:printchr$(157);chr$(191);
1840 ifa$<>""then1890
1850 next:fori=1to15:geta$
1860 printchr$(157);chr$(18);chr$(191);chr$(146);
1870 ifa$<>""then1890
1880 next:goto1830
1890 ifa$<"1"ora$>"5"then1830
1900 de=val(a$):return
1920 printt$:print:print" disk name:";
1930 ifokthenprint#4,"disk name:";
1940 close1:close15:fl=0:l$="":b$=""
1950 open1,8,0,"$":open15,8,15
1960 input#15,e1,e1$
1970 ife1thenprint:print" disk error: "e1;e1$:goto2280
1980 fori=1to33:get#1,a$
1990 l$=l$+a$:next:close1:printl$:print:print:ifokthenprint#4,l$:print#4
2000 printchr$(18);" blocks file name file type"
2010 ifokthenprint#4,"blocks file name file type":print#4
2020 ifokthenprint#4,di$:print#4
2030 open1,8,0,"$"
2040 get#1,a$:get#1,a$:gosub2120
2050 gosub2120:iffl=1thenclose1:close15:goto2280
2060 printright$(sp$+str$(l),4);left$(sp$,5);
2070 ifokthenprint#4,right$(sp$+str$(l),4);left$(sp$,5);
2080 printleft$(b$+sp$,23);ft$
2090 ifokthenprint#4,left$(b$+sp$,18);ft$
2100 goto2050
2120 b$="":get#1,a$:get#1,a$
2130 get#1,a$:l=asc(a$+chr$(0))
2140 get#1,a$:l=l+asc(a$+chr$(0))*256
2150 get#1,a$:input#15,e1,e1$:ife1thenprint:print" disk error: "e1;e1$:goto2280
2160 ifa$=""thenfl=1:return
2170 ifa$<>chr$(34)then2150
2180 get#1,a$
2190 ifpeek(653)then2190
2200 ifa$=chr$(34)then2220
2210 b$=b$+a$:goto2180
2220 get#1,a$:ifa$=chr$(32)then2220
2230 ft$=a$
2240 get#1,a$:ft$=ft$+a$:get#1,a$:ft$=ft$+a$
2250 get#1,a$:ifa$<>""then2250
2260 return
2280 ifokthenprint#4
2290 close1:close4:close15:ok=0
2300 print"":printleft$(sp$,13);chr$(18);"hit any key"
2310 poke198,0:wait198,1:poke198,0
2320 goto240
2340 printt$:print:print
2350 input" name of file : ";nf$:print
2360 input" file type (prg/seq/usr) : ";tf$:print" looking for: ";nf$;",";tf$
2370 open15,8,15,"i0"
2380 open1,8,5,"0:"+nf$+","+left$(tf$,1)+",r"
2390 input#15,e1,e1$,e2,e3
2400 ife1thenprint:print" disk error: "e1;e1$:goto2280
2410 return
2430 ifokthenprint#4
2440 close4:close1:close15:ok=0
2450 printt$:fori=1to10:printchr$(17);chr$(29);:next
2460 print" end of program !!"
2470 end
2490 dimba$(76):fori=0to75
2500 readba$(i):next
2510 data"end ","for ","next "
2520 data"data ","input#","input ","dim "," read ","let "
2530 data"goto ","run","if ","restore ","gosub ","return"
2540 data"rem","stop","on ","wait ","load ","save "
2550 data"verify ","def ","poke ","print#","print","cont"
2560 data"list","clr","cmd ","sys ","open ","close ","get "
2570 data"new","tab("," to ","fn ","spc("," then "
2580 data"not"," step "," + "," - "," * "," / "," ^ "," and "," or "
2590 data"> ","=","<","sgn"," int"," abs","usr","fre"
2600 data"pos","sqr","rnd","log","exp","cos","sin"
2610 data"tan","atn","peek","len","str$","val"
2620 data"asc","chr$","left$","right$","mid$","go"
2630 data***
2640 readba$:ifba$<>"***"thenprint"error in basic data":stop
2650 remassemblyop-codedata
2660 databrk*,oraf,?,?,?,orac,aslc,?
2670 dataphp*,orab,asl*,?,?,oraa,asla,?
2680 databplj,orag,?,?,?,orah,aslh,?
2690 dataclc*,orae,?,?,?,orad,asld,?
2700 datajsra,andf,?,?,bitc,andc,rolc,?
2710 dataplp*,andb,rol*,?,bita,anda,rola,?
2720 databmij,andg,?,?,?,andh,rolh,?
2730 datasec*,ande,?,?,?,andd,rold,?
2740 datarti*,eorf,?,?,?,eorc,